//
//  NSString+Manager.m
//  WorkManager
//
//  Created by ukongm on 17/2/7.
//  Copyright © 2017年 ukongm. All rights reserved.
//

#import "NSString+Manager.h"
#import <CommonCrypto/CommonDigest.h>
@implementation NSString (Manager)

- (instancetype)md5{
    const char* str = [self UTF8String];
    unsigned char result[CC_MD5_DIGEST_LENGTH];
    CC_MD5(str, (unsigned)strlen(str), result);
    NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2];//
    
    for(int i = 0; i<CC_MD5_DIGEST_LENGTH; i++) {
        [ret appendFormat:@"%02x",result[i]];
    }
    return ret;
}

@end
